//对vuex的封装
const state= {
    //定义数据
    username:'赵六',
    all:['aa','bb','cc']
}
const getters={
    allLength:(state: { all: string | any[] })=>state.all.length,
    username:(state: { username: any })=>state.username
}
const actions={
    //一些操作数据的方法
    changeAction:(context: { commit: (arg0: string, arg1: any) => void }, newName: any)=>{
        context.commit('changeMutation',newName)
    }
}
const mutations= {
    //真正去修改数据的地方
    changeMutation (state: { username: any }, newName: any) {
        console.log(newName);
        state.username = newName
    }
}

export default {
    state, getters, actions, mutations
}
